package com.yrot.admin.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yrot.admin.entity.SysQuestionBank;
import com.yrot.admin.entity.SysResult;
import com.yrot.admin.service.ISysResultService;
import com.yrot.common.result.Result;
import com.yrot.common.result.ResultUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hemin
 * @since 2019-04-02
 */
@RestController
@RequestMapping("/admin/result")
public class SysResultController {

    @Autowired
    ISysResultService resultService;

    @GetMapping("/results")
    public Result questionBanks(int page, int limit,
                                @RequestParam(value = "trainId",required = false) Integer trainId,
                                @RequestParam(value = "name",required = false) String name,
                                @RequestParam(value = "isPass",required = false)Integer isPass){
        if(trainId==null){
            return ResultUtils.success();
        }
        return resultService.getResultsByTrainId(page,limit,trainId,name,isPass);
    }

}
